local please = {"Please?", "Pretty please?", "Aww, c'mon, just this once?", "#LIGHT_GREEN#*Sneak by him*", "#LIGHT_GREEN#*Bribe him*", "#LIGHT_GREEN#*Take back everything you said about his mother*"}

local player_boss = ""
if game.player.faction == "air" then player_boss = "Ariel, Queen of Air, "
elseif game.player.faction == "earth" then player_boss = "Quaker, Master of Earth, "
elseif game.player.faction == "fire" then player_boss = "Vargo, Tyrant of Fire, "
elseif game.player.faction == "water" then player_boss = "Waldern, King of Water, "
end



newChat{ id="first",
	text = [[#WHITE#Halt! Who goes there?]],
	answers = {
		{"Just me, " .. game.player.name .. ", a " .. game.player.faction .. " elemental.", cond = function(npc, player) if player.faction == npc.faction then return true end return false end, jump="same"},
		{"Just me, " .. game.player.name .. ", a " .. game.player.faction .. " elemental.", cond = function(npc, player) if player.faction == npc.faction or player.faction == "chaos" then return false end return true end, jump="different"},
		{"Die!", cond = function(npc, player) if player.faction == npc.faction then return false end return true end, action = function(npc, player) npc.no_blow = false npc.invulnerable = false npc. never_move = false end},
	}
}

newChat{ id="same",
	text = "#WHITE#Oh, hey " .. game.player.name .. "! Sorry I didn't recongize you at first." .. player_boss .. "asked me to guard our portal and not let anyone in unless they have a really good reason, but I figure not attacking me on sight is a pretty good reason.",
	answers = {
		{"Thanks!", action=function(npc, player) npc:die() end},
	}
}

newChat{ id="different",
	text = [[#WHITE#Sorry, but I won't allow you to pass unless you have a *really* good reason!]],
	answers = {
		{player_boss .. "thinks that chaos is again trying to break into the world, but that maybe the ruler in the mana temple can stop them! But I was told that the orbs were the only way there.",
			cond = function(npc, player) if player.faction ~= "mana" and player:isQuestStatus("orb-collection", engine.Quest.PENDING) then return true end return false end,
			action = function(npc, player) npc:die() end},
		{"I am trying to get back to my realm to talk with Akraad about the incursion of chaos, but I think I need to collect the elemental orbs to activate the portal to my realm!",
			cond=function(npc, player) if player.faction == "mana" and player:isQuestStatus("orb-collection", engine.Quest.PENDING) then return true end return false end,
			action=function(npc, player) npc:die() end},
		{"Aww, man! Please can you make an exception for me?", jump="exception"},
		{"Ok, fine! I'll be back!"},
		{"How about this? DIE!", action = function(npc, player) npc.no_blow = false npc.invulnerable = false npc. never_move = false end},
	}
}

newChat{ id="exception",
	text = [[#WHITE#Nope, sorry!]],
	answers = {
		{rng.table(please), jump="exception"},	-- yay random speech, in a loop :D
		{"Ok, fine! I'll be back!"},
		{"How about this? DIE!", action = function(npc, player) npc.no_blow = false npc.invulnerable = false npc. never_move = false end},
	}
}

return "first"